<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>混入的引入</title>
</head>
<body>
<div id="app">
    <cpn1></cpn1>
    <cpn2></cpn2>
</div>

<template id="cpn1">
    <h1 v-on:click="btnClicked">组件1 内容</h1>
</template>

<template id="cpn2">
    <h1 v-on:click="btnClicked">组件2 内容</h1>
</template>


<script type="module">
    import {createApp, ref} from "../../../../js/vue.esm-browser.js";
    import {defineComponent} from "../../../../js/vue.esm-browser.js";

    let cpn1 = defineComponent(
        {
            template: "#cpn1",
            setup() {
                let message = ref("Hello, World!")

                function btnClicked() {
                    console.log("组件中的 message：" + message.value);
                }

                return {
                    message,
                    btnClicked,
                }
            }
        }
    )

    let cpn2 = defineComponent(
        {
            template: "#cpn2",
            setup() {
                let message = ref("Hello, World!")

                function btnClicked() {
                    console.log("组件中的 message：" + message.value);
                }

                return {
                    message,
                    btnClicked,
                }
            }
        }
    );


    let app = createApp(
        {
            setuo() {
                return {}
            },
            components: {
                cpn1, cpn2,
            }
        }
    )

    app.mount("#app")
</script>
</body>
</html>